package com.hs.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hs.sfzy.entity.Article;
import com.hs.sfzy.entity.Company;
import com.hs.sfzy.mapper.ArticleMapper;
import com.hs.sfzy.mapper.CompanyMapper;
import com.hs.sfzy.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyServiceImpl implements CompanyService {
    @Autowired
    private CompanyMapper companyMapper;

    @Override
    public int insert(Company company) {
        return companyMapper.insert(company);
    }

    @Override
    public int delete(int id) {
        return companyMapper.delete(id);
    }

    @Override
    public int update(Company company) {
        return companyMapper.update(company);
    }

    @Override
    public List<Company> selectAll(Company company) {
        return companyMapper.selectAll(company);
    }

    @Override
    public Company selectById(int id) {
        return companyMapper.selectById(id);
    }




    @Override
    public PageInfo<Company> selectByPageInfo(int pageNum, int pageSize, Company company) {
        PageHelper.startPage(pageNum,pageSize);
        List<Company> list = companyMapper.selectAll(company);
        PageInfo<Company> pageInfo = new PageInfo<Company>(list);
        return pageInfo;
    }

}
